Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

txmgr: Add min basefee and tip cap parameters to enforce fee minima #8799

Merged
merged 2 commits into from
Jan 3, 2024

Conversation

sebastianst
Copy link
Member

Description

Adds two new parameters to the transaction manager that specify a min basefee and tip cap to use when performing fee estimations.

Default is off, so no minima are enforced. This is primarily helpful for low-fee testnets.

Tests

Test added for all combinations of the parameters.

Additional context

This allows for dealing with super-low fee testnets, where sudden fee "spikes" will keep transactions from being included, even though the absolute fees are still very low.

@sebastianst sebastianst self-assigned this Jan 2, 2024
@sebastianst sebastianst requested a review from a team as a code owner January 2, 2024 17:04
@sebastianst sebastianst requested review from trianglesphere and removed request for a team January 2, 2024 17:04
@sebastianst sebastianst force-pushed the seb/txmgr-fee-minima branch from ac391ab to bb146c4 Compare January 2, 2024 17:25
Copy link
Contributor

@axelKingsley axelKingsley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

I am wondering, however: when it is time to leverage these new flags (likely to avoid poor behavior during low gas periods), what is the operational expectation? Will this flag be active on test-nets by default, or will the service be restarted with these values when encountering issues?

op-service/txmgr/cli.go Outdated Show resolved Hide resolved
@sebastianst sebastianst force-pushed the seb/improve-txmgr-metrics-logging branch from 5efe0a6 to 900ec63 Compare January 3, 2024 11:41
@sebastianst sebastianst force-pushed the seb/txmgr-fee-minima branch from bb146c4 to 86e731e Compare January 3, 2024 11:41
Copy link
Contributor

semgrep-app bot commented Jan 3, 2024

Semgrep found 3 sol-style-notice-over-dev-natspec findings:

  • packages/contracts-bedrock/src/dispute/interfaces/IOutputBisectionGame.sol: L57, L38, L12

Prefer @notice over @dev in natspec comments

Ignore this finding from sol-style-notice-over-dev-natspec.

@sebastianst sebastianst force-pushed the seb/txmgr-fee-minima branch from 054f903 to fea6676 Compare January 3, 2024 12:22
Base automatically changed from seb/improve-txmgr-metrics-logging to develop January 3, 2024 12:24
@sebastianst sebastianst force-pushed the seb/txmgr-fee-minima branch from fea6676 to 4b9e561 Compare January 3, 2024 12:45
Copy link
Contributor

coderabbitai bot commented Jan 3, 2024

Walkthrough

Walkthrough

The updates involve the introduction of a new conversion function in ether.go, allowing Gwei to Wei conversion, with robust error handling. In ether_test.go, corresponding tests ensure accuracy and error management. The txmgr package has been enhanced with minimum basefee and tip cap settings, including CLI flags, configuration adjustments, and validation methods. These additions ensure that gas price suggestions honor minimum thresholds, a change reflected in both the code and its associated tests.

Changes

File(s) Change Summary
op-service/eth/ether.go Added GweiToWei function for Gwei to Wei conversion with error handling.
op-service/eth/ether_test.go Introduced TestGweiToWei to test Gwei to Wei conversion for various scenarios.
op-service/txmgr/cli.go, txmgr.go Imported eth package, added flags and fields for min basefee and tip cap, and included validation and conversion logic in CLI and config.
op-service/txmgr/txmgr_test.go Modified test names for clarity and added TestMinFees for testing min basefee and tip cap scenarios.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • You can directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
  • You can tag CodeRabbit on specific lines of code or entire files in the PR by tagging @coderabbitai in a comment. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • You can tag @coderabbitai in a PR comment and ask questions about the PR and the codebase. Examples:
    • @coderabbitai generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid.
    • @coderabbitai read the files in the src/scheduler package and generate README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

@sebastianst
Copy link
Member Author

sebastianst commented Jan 3, 2024

I am wondering, however: when it is time to leverage these new flags (likely to avoid poor behavior during low gas periods), what is the operational expectation? Will this flag be active on test-nets by default, or will the service be restarted with these values when encountering issues?

I assume we just configure this once on a testnet that's causing trouble, like L1 Goerli, and keep the configuration change. E.g. on Goerli, it doesn't really matter whether we pay 1 wei or 100,000 wei gas fees.

@sebastianst sebastianst added this pull request to the merge queue Jan 3, 2024
Merged via the queue into develop with commit 104909c Jan 3, 2024
61 checks passed
@sebastianst sebastianst deleted the seb/txmgr-fee-minima branch January 3, 2024 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants